package com.society.sgsc.jwt.config;

import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;  
  
// @Configuration
public class MyConfig implements WebMvcConfigurer {  
    @Override  
    public void addCorsMappings(CorsRegistry registry) {  
        registry.addMapping("/**")  
                .allowedOrigins("*") // 允许跨域的源地址
                .allowedMethods("GET", "POST", "PUT", "DELETE") // 允许的请求方法  
                .allowedHeaders("Authorization", "Content-Type", "X-Requested-With"); // 允许的请求头部信息，包含自定义的token名称
    }  
}